import util from './util.js'
let _SYT_util=util._SYT_util;
module.exports = {
  formatDate_HM: function (input) {
    var returnDate = "";
    if (input) {
      returnDate = input.substring(0, 4) + "-" + input.substring(4, 6) + "-" + input.substring(6, 8) + '  ' + input.substring(8, 10) + ':' + input.substring(10, 12);
    }
    return returnDate;
  },
  bizStage: function (input) {
    if (input == '1') {
      return '风控阶段';
    } else if (input == '2') {
      return '诉讼阶段';
    } else if (input == '3') {
      return '执行阶段';
    } else if (input == '4') {
      return '结算阶段';
    } else {
      return ''
    }
  },
  dateStr:function(input){
    var returnDate = "";
    if (input) {
      returnDate = input.substring(0, 4) + "-" + input.substring(4, 6) + "-" + input.substring(6, 8);
    }
    return returnDate;
  },
  timeHM: function (input) {
    var returnDate = "";
    if (input) {
      returnDate = input.substring(0, 2) + ":" + input.substring(2, 4);
    }
    return returnDate;
  },
  filterAmount: function (input) {
    var unit = "";
    if (input != "" && input != null) {
      var amt = _SYT_util.formatMoney(_SYT_util.math.accDiv(input * 1, 10000), 0);
      if (amt == 0) {
        amt = _SYT_util.formatMoney(_SYT_util.math.accDiv(input * 1, 10000), 1);
      }
      if (amt > 9999) {
        unit = _SYT_util.formatMoney(_SYT_util.math.accDiv(amt * 1, 10000), 2);
      } else {
        unit = amt;
      }
    }
    return unit;
  },
  filterUnit: function (input) {
    var unit = "万元";
    if (input != "" && input != null) {
      var amt = _SYT_util.formatMoney(_SYT_util.math.accDiv(input * 1, 10000), 0);
      if (amt > 9999) {
        unit = "亿元";
      }
    }
    return unit;
  }
}
